<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<div th:replace="fragment/headFragment:: head"></div>
<body class="cbp-spmenu-push">
<div class="main-content">
    <!--left-fixed -navigation-->
    <div th:replace="fragment/left_sidebar:: left_sidebar"></div>
    <!--left-fixed -navigation-->
    <!-- header-starts -->
    <div th:replace="fragment/header_section::header_section"></div>
    <!-- //header-ends -->
    <!-- main content start-->
    <div id="page-wrapper">
        <div class="main-page">
            <div class="panel-body widget-shadow">
                <h4 th:text="${main}">Basic Table:</h4>

                <div class="inline-form widget-shadow">
                    <div class="form-body">
                        <div data-example-id="simple-form-inline">
                            <form class="form-inline" th:action="@{/workOrder/select(current=1,size=10)}" method="post"
                                  name="form1">
                                <div class="form-group">
                                    <select name="state" th:value="state">
                                        <option value="" th:selected="${state==''}">全部状态</option>
                                        <option value="未分配" th:selected="${state=='未分配'}">未分配</option>
                                        <option value="待处理" th:selected="${state=='待处理'}">待处理</option>
                                        <option value="处理中" th:selected="${state=='处理中'}">处理中</option>
                                        <option value="已解决" th:selected="${state=='已解决'}">已解决</option>
                                        <option value="已关闭" th:selected="${state=='已关闭'}">已关闭</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <select name="priority" th:value="priority">
                                        <option value="" th:selected="${priority==''}">全部优先级</option>
                                        <option value="低" th:selected="${priority=='低'}">低</option>
                                        <option value="中" th:selected="${priority=='中'}">中</option>
                                        <option value="高" th:selected="${priority=='高'}">高</option>
                                        <option value="紧急" th:selected="${priority=='紧急'}">紧急</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <select name="worktype" th:value="worktype">
                                        <option value="" th:selected="${worktype==''}">全部分类</option>
                                        <option value="分类一" th:selected="${worktype=='分类一'}">分类一</option>
                                        <option value="分类二" th:selected="${worktype=='分类二'}">分类二</option>
                                        <option value="分类三" th:selected="${worktype=='分类三'}">分类三</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <select name="channel" th:value="channel">
                                        <option value="" th:selected="${channel==''}">全部渠道</option>
                                        <option value="手动录入" th:selected="${channel=='手动录入'}">手动录入</option>
                                        <option value="即时聊天" th:selected="${channel=='即时聊天'}">即时聊天</option>
                                        <option value="客户管理" th:selected="${channel=='客户管理'}">客户管理</option>
                                    </select>
                                </div>
                                <div class="form-group">客服id：
                                    <input type="number" class="form-control" name="customerserviceid"
                                           th:attr="value=${customerserviceid}"
                                           oninput="if(value<=0)value=1">
                                </div>
                                <div class="form-group">客户id：
                                    <input type="number" class="form-control" name="customerid"
                                           th:attr="value=${customerid}"
                                           oninput="if(value<=0)value=1">
                                </div>

                                <button type="submit" class="btn btn-default">查询</button>

                                <a th:href="@{/workOrder/add}">
                                    <button type="button" class="btn btn-default" style="text-align: center">添加
                                    </button>
                                </a>
                                <a th:href="@{/workOrder/index(current=1,size=10)}">
                                    <button type="button" class="btn btn-default">返回</button>
                                </a>
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th>工单id</th>
                                        <th>工单标题</th>
                                        <th>工单渠道</th>
                                        <th>工单状态</th>
                                        <th>工单优先级</th>
                                        <th>工单分类</th>
                                        <th>客服id</th>
                                        <th>客户id</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="cs : ${list}">
                                        <td th:text="${cs.getId()}"></td>
                                        <td th:text="${cs.getTitle()}"></td>
                                        <td th:text="${cs.getChannel()}"></td>
                                        <td th:text="${cs.getState()}"></td>
                                        <td th:text="${cs.getPriority()}"></td>
                                        <td th:text="${cs.getWorktype()}"></td>
                                        <td th:text="${cs.getCustomerserviceid()}"></td>
                                        <td th:text="${cs.getCustomerid()}"></td>
                                        <td>
                                            <a th:href="@{/workOrder/detail(id = ${cs.getId()},current=${#request.getParameter('current')},size=10)}">详情</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <div style="text-align: center">
                                    <a th:href="@{/workOrder/select(current=1,size=10,state=${#request.getParameter('state')} ,priority=${#request.getParameter('priority')},workType=${#request.getParameter('workType')}, channel=${#request.getParameter('channel')},customerserviceid=${#request.getParameter('customerserviceid')},customerid=${#request.getParameter('customerid')}  )}">首页</a>
                                    <a th:href="@{/workOrder/select(current=${i},size=10,state=${#request.getParameter('state')} ,priority=${#request.getParameter('priority')},workType=${#request.getParameter('workType')}, channel=${#request.getParameter('channel')},customerserviceid=${#request.getParameter('customerserviceid')},customerid=${#request.getParameter('customerid')} )}"
                                       th:each="i : ${#numbers.sequence(1,pagesCount)}"><span th:text="${i}"
                                                                                              style="border: 1px solid #e3e3e3; height: 16px;width: 16px;text-align: center;vertical-align: middle;padding-left: 5px;padding-right: 5px">1</span>
                                    </a>
                                    <a th:href="@{/workOrder/select(current=${pagesCount},size=10,state=${#request.getParameter('state')} ,priority=${#request.getParameter('priority')},workType=${#request.getParameter('workType')}, channel=${#request.getParameter('channel')},customerserviceid=${#request.getParameter('customerserviceid')},customerid=${#request.getParameter('customerid')} )}">尾页</a>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <!--footer-->
    <div class="footer">
        <p>Copyright &copy; 2021.Igeek All rights reserved.</p>
    </div>
    <!--//footer-->
</div>
<!-- Classie -->
<script src="js/classie.js"></script>
<script>
    var menuLeft = document.getElementById('cbp-spmenu-s1'),
        showLeftPush = document.getElementById('showLeftPush'),
        body = document.body;

    showLeftPush.onclick = function () {
        classie.toggle(this, 'active');
        classie.toggle(body, 'cbp-spmenu-push-toright');
        classie.toggle(menuLeft, 'cbp-spmenu-open');
        disableOther('showLeftPush');
    };


    function disableOther(button) {
        if (button !== 'showLeftPush') {
            classie.toggle(showLeftPush, 'disabled');
        }
    }
</script>
<!--scrolling js-->
<script src="js/jquery.nicescroll.js"></script>
<script src="js/scripts.js"></script>
<!--//scrolling js-->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.js"></script>
<script type="text/javascript">
    //实例：button按钮，结合onclick事件，验证和提交表单
    function checkForm() {
        //使用form对象的submit()方法，实现提交，不用return
        document.getElementById("form1").submit();
    }
</script>
</body>
</html>